﻿using PC.AzureMultiApp.Core.Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using PC.AzureMultiApp.Storage;
using PC.AzureMultiApp.Core.Models;

namespace Core.Test
{
    
    [TestClass()]
    public class ConversionsTest
    {

        [TestMethod()]
        public void GetApplicationModelTest()
        {
            AzureApplicationEntity app = new AzureApplicationEntity()
            {
                ApplicationName = "app",
                ApplicationUrl = "url",
                BlobUrl = "BlobUrl",
                Name = "Name",
                Label = "Label",
                Version = "Version",
                Status = "Deploying",
                UniqueId = "UniqueId",
                IsWebDeploy = true
            };

            ApplicationModel actual = Conversions.GetApplicationModel(app);

            Assert.AreEqual(actual.ApplicationName, app.ApplicationName);
            Assert.AreEqual(actual.ApplicationUrl, app.ApplicationUrl);
            Assert.AreEqual(actual.BlobUrl, app.BlobUrl);
            Assert.AreEqual(actual.Name, app.Name);
            Assert.AreEqual(actual.Label, app.Label);
            Assert.AreEqual(actual.Version, app.Version);
            Assert.AreEqual(actual.Status, app.Status);
            Assert.AreEqual(actual.UniqueId, app.UniqueId);
            Assert.AreEqual(actual.IsWebDeploy, app.IsWebDeploy);
        }


        [TestMethod()]
        public void GetAzureApplicationTest()
        {
            ApplicationModel app = new ApplicationModel()
            {
                ApplicationName = "app",
                ApplicationUrl = "url",
                BlobUrl = "BlobUrl",
                Name = "Name",
                Label = "Label",
                Version = "Version",
                Status = "Deploying",
                UniqueId = "UniqueId",
                IsWebDeploy = true
            };

            AzureApplicationEntity actual = Conversions.GetAzureApplication(app);

            Assert.AreEqual(actual.ApplicationName, app.ApplicationName);
            Assert.AreEqual(actual.ApplicationUrl, app.ApplicationUrl);
            Assert.AreEqual(actual.BlobUrl, app.BlobUrl);
            Assert.AreEqual(actual.Name, app.Name);
            Assert.AreEqual(actual.Label, app.Label);
            Assert.AreEqual(actual.Version, app.Version);
            Assert.AreEqual(actual.Status, app.Status);
            Assert.AreEqual(actual.UniqueId, app.UniqueId);
            Assert.AreEqual(actual.IsWebDeploy, app.IsWebDeploy);
        }
    }
}
